package vashion.azeroth.core.service.tran.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import vashion.azeroth.core.manager.personal.tran.PersonalTranDetailManager;
import vashion.azeroth.core.personal.tran.pojo.PersonalTranDetail;
import vashion.azeroth.core.result.ApiResult;
import vashion.azeroth.core.service.base.BaseService;
import vashion.azeroth.core.service.tran.PersonalTranDetailService;

@Service
public class PersonalTranDetailServiceImpl extends BaseService implements PersonalTranDetailService<PersonalTranDetail> {
	
	@Autowired
	private PersonalTranDetailManager tranDetailManager;

	@Override
	public ApiResult<List<PersonalTranDetail>> queryTranDetail(PersonalTranDetail tranDetail) {
		
		ApiResult<List<PersonalTranDetail>> result = new ApiResult<List<PersonalTranDetail>>();
		
		Integer count = tranDetailManager.findCnt(tranDetail);
		
		initPages(tranDetail, count);
		
		result.setTotalCount(count);
		
		List<PersonalTranDetail> tranDetails = tranDetailManager.find(tranDetail);
		
		if(null == tranDetails) {
			result.setData(null);
			return result;
		}
		
		result.setData(tranDetails);
		return result;
	}

}
